package org.mysocial.datamodel;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "message")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
public abstract class Message implements Serializable
{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private long id;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "sender_account_fk")
	private Account sender;

	private Date sentDate;

	private String text;

	public long getId()
	{
		return id;
	}

	public Account getSender()
	{
		return sender;
	}

	public Date getSentDate()
	{
		return sentDate;
	}

	public String getText()
	{
		return text;
	}

	public void setId(long id)
	{
		this.id = id;
	}

	public void setSender(Account sender)
	{
		this.sender = sender;
	}

	public void setSentDate(Date sentDate)
	{
		this.sentDate = sentDate;
	}

	public void setText(String text)
	{
		this.text = text;
	}
}
